package org.msfj.common.model;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

public class Page {

    @Min(1)
    private int page = 1;
    @Max(200)
    private int pageSize = 50;

    public int getOffset() {
        return (page - 1) * pageSize;
    }


    public Page() {
    }

    public Page(int page, int pageSize) {
        this.page = page;
        this.pageSize = pageSize;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }


    @Override
    public String toString() {
        return "(page:" + this.getPage() + " pageSize:" + this.getPageSize() + ")";
    }
}
